<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>华信满意度系统</title>

<meta name="description" content="User login page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/css/bootstrap.css" />
<link rel="stylesheet" href="assets/css/font-awesome.css" />
<!-- text fonts -->
<link rel="stylesheet" href="assets/css/ace-fonts.css" />
<!-- ace styles -->
<link rel="stylesheet" href="assets/css/ace.css" />
<link rel="stylesheet" href="assets/css/ace-rtl.css" />
<link rel="stylesheet" href="css/login.css" />
</head>

<body class="login-layout light-login">
	<div class="main-container">
		<div class="main-content">
			<div class="row">
				<div class="col-sm-10 col-sm-offset-1">
					<div class="login-container">
						<div class="center">
							<h1>
								<i class=""></i>
							</h1>
						</div>
						<div class="space-6"></div>
						<div class="position-relative" style="margin-top: 20%;">
							<div id="login-box" class="login-box visible widget-box no-border">
								<!-- /.widget-main -->
								<div class="toolbar clearfix" style="opacity: 0.8">
									<div>
										<center>
											<img src="images/logo-light.png">
										</center>
									</div>

								</div>
								<div class="widget-body">
									<div class="widget-main">
										<h3 class="header white lighter bigger center" style="font-family:'微软雅黑';">
											华信满意度系统
										</h3>
										<div class="space-6"></div>
										<form id="loginForm">
											<fieldset>

												<label class="block clearfix">
													<span class="block input-icon input-icon-right">
														<input type="text" class="form-control" placeholder="用户名" name="username" id="username" />
														<i class="ace-icon fa fa-user"></i>
													</span>
												</label>
												<label class="block clearfix">
													<span class="block input-icon input-icon-right">
														<input type="password" class="form-control" placeholder="密码" name="password" id="password" />
														<i class="ace-icon fa fa-lock"></i>
													</span>
												</label>


												<div class="space"></div>

												<div class="clearfix">
													<button type="button" id="login-btn" class="width-35 pull-left btn btn-sm btn-danger">
														<i class="ace-icon fa fa-key"></i>
														<span class="bigger-110">登录</span>
													</button>
													<button type="reset" class="width-35 pull-right btn btn-sm">
														<i class="ace-icon fa fa-refresh"></i>
														<span class="bigger-110">重置</span>
													</button>

												</div>

												<div class="space-4"></div>
											</fieldset>
										</form>
									</div>

								</div>
								<div class="widget-body">
									<img src="images/login-right.png" width="374px" height="333">
								</div>
								<!-- /.widget-body -->
							</div>
							<!-- /.login-box -->
						</div>
						<!-- /.position-relative -->
					</div>
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.main-content -->
	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->


	<script type="text/javascript">
		if('ontouchstart' in document.documentElement)
	        document.write("<script src='assets/js/jquery.mobile.custom.js'>" + "<"+"/script>");
	</script>


	<%--引入jq--%>
	<script src="js/jquery-2.1.0.js"></script>
	<!-- layer -->
	<script src="assets/js/layer-v3.1.0/layer/layer.js"></script>
	<script>
			//登录验证
      $().ready(function () {


          // 在键盘按下并释放提交登录信息
          $("#login-btn").click(function () {
							var $username = $("#username");
							var $password = $("#password");
              var userparams = $username.attr('name') + '=' + $username.val()
                  + "&" + $password.attr('name') + '=' + $password.val();

							console.log(userparams);
              //ajax提交验证
              $.ajax({

                  type:'post',
                  url:'${pageContext.request.contextPath }/admin/userLogin.go',
                  data:  userparams,
                  dataType: 'json',
                  success: function (rep) {

                      if (rep.state=='OK'){
                          window.location.href="${pageContext.request.contextPath }/admin/userHome.go";
                      }else {
                          layer.msg('用户名或密码错误!',{icon: 6});
                      }
                  },
                  error: function (rep) {
                      layer.msg('未知错误!登录失败',{icon: 6});
                  }


              });

          });
      });
	</script>

</body>
</html>


